package stream;

import lombok.Data;

import java.util.*;
import java.util.stream.Stream;

/**
 * @time: 2019/12/3 13:09
 * @author: baozi
 */

@Data
public class streamDemo1 {

    public streamDemo1(String name) {
        this.name = name;
    }
    public streamDemo1() {
    }

    public String name;
    public String age;
    public String num;




    public  void aaa(){
        System.out.println("aaa");
    }
    public  void bbb(){
        ccc(this::aaa);
        ccc(()->{});
    }
    public  void ccc(functonInftac a){

    }
    public  void ccc(String a){

    }

    public static void main(String[] args) {


        //获取stream2方法
        //1
        Arrays.asList(1,2,3).stream();
        Map<String,String> maps=new HashMap();
        Set set=maps.keySet();//key集合
        Collection<String> collection=maps.values();//value集合
        Set<Map.Entry<String,String>> entrySet=maps.entrySet();//key,value集合
        //2
        Stream<Integer> stream=Stream.of(1,2,3);
        Integer[] a=new Integer[]{1,2};
        Stream<Integer> strea=Stream.of(a);

       // stream.filter()
       // stream.forEach()
       // stream.map()
       // stream.count();//返回long类型的长度
       // stream.limit()//截取前几个元素
       // stream.skip()//跳过前几获取后面元素
       // Stream.concat(sa,sb);//把2个流合成一个

        Stream<a> sa=Stream.of(new streamDemo1().new a("name_a1"),new streamDemo1().new a("name_a2"));
        Stream<b> sb=Stream.of(new streamDemo1().new b("name_b1"),new streamDemo1().new b("name_b2"));
        Stream ss=Stream.concat(sa,sb);//把2个流合成一个
        ss.forEach(o-> System.out.println(o.getClass()));





    }

    @Data
    public  class a{
        private String name;

        public a(String name) {
            this.name = name;
        }
    }
    @Data
    public  class b{
        private String name;

        public b(String name) {
            this.name = name;
        }
    }

}
